package com.ruoyi.hiscomm.domain;

import co.elastic.clients.elasticsearch._types.mapping.Property;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.*;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
 * 科室字典实体类
 */

@Builder(toBuilder = true)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@TableName("dept_dict")
public class DeptDictDo implements Serializable {

    private static final long serialVersionUID = 1L;

    @Excel(name = "医院ID")
    @NonNull
    private String hospitalId;

    @Excel(name = "序号")
    private Integer serialNo;

    @Excel(name = "科室代码")
    @NonNull
    private String deptCode;

    @Excel(name = "科室名称")
    @NonNull
    private String deptName;

    @Excel(name = "科室别名")
    private String deptAlias;

    @Excel(name = "拼音码")
    private String inputCode;

    @Excel(name = "有效标记", readConverterExp = "1=是,0=否")
    @Builder.Default
    private Integer enable = 1; // 默认值 1（有效）

    @Excel(name = "创建日期", width = 30,dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date createDate;

    @Excel(name = "更新日期", width = 30,dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date updateDate;

    @TableField(exist = false)
    private String id;

    public void generateId() {
        this.id = hospitalId + "||" + deptCode;
    }

    public void setId(String id) {
        this.id = id;
    }

    public DeptDictDo() {
    }
    public String getHospitalId() {
        return hospitalId;
    }

    public void setHospitalId(String hospitalId) {
        this.hospitalId = hospitalId;
    }

    public Integer getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(Integer serialNo) {
        this.serialNo = serialNo;
    }

    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getDeptAlias() {
        return deptAlias;
    }

    public void setDeptAlias(String deptAlias) {
        this.deptAlias = deptAlias;
    }

    public String getInputCode() {
        return inputCode;
    }

    public void setInputCode(String inputCode) {
        this.inputCode = inputCode;
    }

    public Integer getEnable() {
        return enable;
    }

    public void setEnable(Integer enable) {
        this.enable = enable;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public String getId() {
        return id;
    }

    // equals 和 hashCode 保持不变
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DeptDictDo that = (DeptDictDo) o;
        return Objects.equals(hospitalId, that.hospitalId) &&
                Objects.equals(deptCode, that.deptCode);
    }

    @Override
    public int hashCode() {
        return Objects.hash(hospitalId, deptCode);
    }
}